﻿using System;
using System.Collections.Generic;
using System.Text;
using Mogre;

namespace AplikacjaOgre
{
    class GameCamera
    {
        #region Zmienne definiujące parametry kamery

        public Player Character;
        public float Distance;
        public Degree Angle;

        #endregion

        #region Funkcje kamery

        public void Update()
        {
            Vector3 offset = Character.Node.Orientation *(-Vector3.UNIT_Z + (Vector3.UNIT_Y * (float)System.Math.Tan(Angle.ValueRadians))).NormalisedCopy * Distance;
        
            Vector3 head = Character.Node.Position + Character.HeadOffset;
            Vector3 desiredPosition = head + offset;

            Game.Instance.Camera.Position += (desiredPosition - Game.Instance.Camera.Position) *0.1f;
            Game.Instance.Camera.LookAt(head);  
        }

        #endregion
    }
}
